package pilgun.eshop.domain;

import java.util.Date;

public class OrderStatus {

	Date date;
	String place;
	String status;
	
	public OrderStatus(Date date, String place, String status) {
		this.date = new Date(date.getTime());
		this.status = status;
		this.place = place;
	}
	
	
	@Override
	public String toString() {
		return "OrderStatus [date=" + date + ", place=" + place + ", status="
				+ status + "]";
	}

	public String getPlace() {
		return place;
	}
	public void setPlace(String place) {
		this.place = place;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = new Date(date.getTime());
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((date == null) ? 0 : date.hashCode());
		result = prime * result + ((place == null) ? 0 : place.hashCode());
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		OrderStatus other = (OrderStatus) obj;
		if (date == null) {
			if (other.date != null){
				return false;
			}
		}else{ 
			if (!date.equals(other.date)){
				return false;
			}
		}
		if (place == null) {
			if (other.place != null){
				return false;
			}
		}else{ 
			if (!place.equals(other.place)){
				return false;
			}
		}
		if (status == null) {
			if (other.status != null){
				return false;
			}
		}else{ 
			if (!status.equals(other.status)){
				return false;
			}
		}
		return true;
	}
	
}
